#include "qbaseinit.h"
#include "property/qintproperty.h"
#include "property/qstringproperty.h"
#include "property/qsizeproperty.h"
#include "property/qpointproperty.h"
#include "property/qrectproperty.h"
#include "property/qscriptproperty.h"
#include "property/qtimeproperty.h"
#include "property/qdatetimeproperty.h"
#include "property/qdateproperty.h"
#include "property/qenumproperty.h"
#include "property/qtagproperty.h"
#include "property/qcursorproperty.h"
#include "property/qfloatproperty.h"
#include "property/qfontproperty.h"
#include "property/qmemorydataproperty.h"
#include "property/qbytearrayproperty.h"
#include "property/qboolproperty.h"
#include "property/qalignmentproperty.h"
#include "property/qstylesheetproperty.h"
#include "property/qfileproperty.h"
#include "property/qimageproperty.h"
#include "property/qcolorproperty.h"
#include "property/qtagcolorlistproperty.h"
#include "property/qtagtextlistproperty.h"
#include "property/qfunctionproperty.h"
#include "property/qvarproperty.h"
#include "qpropertyfactory.h"
#include "host/qwidgethost.h"
#include "host/qframehost.h"
#include "host/qsvghost.h"
#include "widgets/qsvgbox.h"
#include "qhostfactory.h"
#include "qwidgetfactory.h"
#include "qpropertylist/qnumbereditor.h"
#include "qpropertylist/qstringeditor.h"
#include "qpropertylist/qcommoneditor.h"
#include "qpropertylist/qfonteditor.h"
#include "qpropertylist/qfloateditor.h"
#include "qpropertylist/qbooleditor.h"
#include "qpropertylist/qbytearrayeditor.h"
#include "qpropertylist/qenumpropertyeditor.h"
#include "qpropertylist/qscripteditor.h"
#include "qpropertylist/stylesheeteditor/qstylesheeteditor.h"
#include "qpropertylist/qfileeditor.h"
#include "qpropertylist/qimageeditor.h"
#include "qpropertylist/qcoloreditor.h"
#include "qpropertylist/qimageeditor.h"
#include "qpropertylist/qfunctioneditor.h"
#include "qpropertylist/qvarpropertyeditor.h"
#include "graphlets/graphletsmanager.h"

void qRegisterBaseProperty()
{
    qRegisterProperty("Number", QIntProperty);
    qRegisterProperty("String", QStringProperty);
    qRegisterProperty("Size", QSizeProperty);
    qRegisterProperty("Rect", QRectProperty);
    qRegisterProperty("Point", QPointProperty);
    qRegisterProperty("Font", QFontProperty);
    qRegisterProperty("Float", QFloatProperty);
    qRegisterProperty("Memory", QMemoryDataProperty);
    qRegisterProperty("Bool", QBoolProperty);
    qRegisterProperty("ByteArray", QByteArrayProperty);
    qRegisterProperty("Enum", QEnumProperty);
    qRegisterProperty("Script", QScriptProperty);
    qRegisterProperty("Cursor", QCursorProperty);
    qRegisterProperty("Time", QTimeProperty);
    qRegisterProperty("Date", QDateProperty);
    qRegisterProperty("DateTime", QDateTimeProperty);
    qRegisterProperty("Alignment", QAlignmentProperty);
    qRegisterProperty("StyleSheet", QStylesheetProperty);
    qRegisterProperty("Tag", QTagProperty);
    qRegisterProperty("File", QFileProperty);
    qRegisterProperty("Image", QImageProperty);
    qRegisterProperty("Color", QColorProperty);
    qRegisterProperty("TagColorList", QTagColorListProperty);
    qRegisterProperty("TagTextList", QTagTextListProperty);
    qRegisterProperty("Function", QFunctionProperty);
    qRegisterProperty("Var", QVarProperty);
}

void qRegisterBaseHost()
{
    QList<Graphlets> grList = GraphletsManager::instance()->getGraphletsList();
    qDebug() << "qbaseinit::qRegisterBaseHost:" << grList.size();
    foreach(Graphlets graph,grList){
        QHostFactory::registerHost(graph.m_gGuid,graph.m_gIcon,graph.m_gName,graph.m_gType,graph.m_gCode,&QSvgHost::staticMetaObject);
    }
    QHostFactory::registerHost("containners.widget",QWidgetHost::getShowIcon(),QWidgetHost::getShowName(), QWidgetHost::getShowGroup(),"",&QWidgetHost::staticMetaObject);
    QHostFactory::registerHost("containners.frame",QFrameHost::getShowIcon(),QFrameHost::getShowName(), QFrameHost::getShowGroup(),"",&QFrameHost::staticMetaObject);
}

void qRegisterWidgets()
{
    QList<Graphlets> grList = GraphletsManager::instance()->getGraphletsList();
    qDebug() << "qbaseinit::qRegisterBaseHost:" << grList.size();
    foreach(Graphlets graph,grList){
        QWidgetFactory::registerWidget(graph.m_gGuid,graph.m_gCode,&QSvgBox::staticMetaObject);
    }
}

void qRegisterBasePropertyEditor()
{
    qRegisterPropertyEditor("Number", QNumberEditor);
    qRegisterPropertyEditor("String", QStringEditor);
    qRegisterPropertyEditor("Size", QCommonEditor);
    qRegisterPropertyEditor("Rect", QCommonEditor);
    qRegisterPropertyEditor("Point", QCommonEditor);
    qRegisterPropertyEditor("Font", QFontEditor);
    qRegisterPropertyEditor("Float", QFloatEditor);
    //qRegisterPropertyEditor("Memory", QMemoryDataProperty);
    qRegisterPropertyEditor("Bool", QBoolEditor);
    qRegisterPropertyEditor("ByteArray", QByteArrayEditor);
    qRegisterPropertyEditor("Enum", QEnumPropertyEditor);
    qRegisterPropertyEditor("Script", QScriptEditor);
    qRegisterPropertyEditor("Cursor", QEnumPropertyEditor);
    qRegisterPropertyEditor("StyleSheet", QStyleSheetEditor);
    //qRegisterPropertyEditor("Time", QTimeProperty);
    //qRegisterPropertyEditor("Date", QDateProperty);
    //qRegisterPropertyEditor("DateTime", QDateTimeProperty);
    qRegisterPropertyEditor("Tag", QEnumPropertyEditor);
    qRegisterPropertyEditor("File", QFileEditor);
    qRegisterPropertyEditor("Image", QImageEditor);
    qRegisterPropertyEditor("Color", QColorEditor);
    qRegisterPropertyEditor("Var", QVarPropertyEditor);
    qRegisterPropertyEditor("Function", QFunctionEditor);
}
